// <copyright file="Expansion.cs" company="Microsoft">
//      Copyright (c) Microsoft Corporation.  All rights reserved.
// </copyright>
//---------------------------------------------------------------------

namespace Microsoft.Data.OData.Query.SemanticAst
{
    using System.Collections.Generic;
    using System.Linq;

    /// <summary>
    /// A list of all expanded items at the next level down.
    /// </summary>
    internal sealed class Expansion
    {
        /// <summary>
        /// The list of all expanded items at the next level down.
        /// </summary>
        private readonly IEnumerable<ExpandedNavigationSelectItem> expandItems;

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="expandItems">The list of all expanded items at the next level down.</param>
        public Expansion(IEnumerable<ExpandedNavigationSelectItem> expandItems)
        {
            DebugUtils.CheckNoExternalCallers();
            this.expandItems = expandItems as ExpandedNavigationSelectItem[] ?? expandItems.ToArray();
        }
        
        /// <summary>
        /// The list of all expanded items at the next level down.
        /// </summary>
        public IEnumerable<ExpandedNavigationSelectItem> ExpandItems
        {
            get
            {
                DebugUtils.CheckNoExternalCallers(); 
                return this.expandItems;
            }
        }
    }
}